#include <vector>

using namespace std;

class Solution {
public:
    void rotate(vector<int>& nums, int k) {
        k %= nums.size();
        for (int start = 0, count = 0; count < nums.size(); start++) {
            int current = start;
            int prev = nums[current];
            do {
                current = (current + k) % nums.size();
                swap(prev, nums[current]);
                count++;
            } while (current != start);
        }
    }
};

int main() {
    vector<int> input = {1, 2, 3, 4, 5, 6};
    Solution solution;
    solution.rotate(input, 4);
    return 0;
}